<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/6
 * Time: 20:55
 */


require_once "../../php/config/database.php";
require_once "adminDb.php";
$AdminDb=new AdminDb();
$user=$_POST['user'];
$password=$_POST['pass'];
$addtime=time();
$password=md5($password);
$data=$AdminDb->selectUser($user,$password);
session_start();
$_SESSION['user']=$user;
try {
    $result = $data;
    if ($result) {
        $dat = array(

            'message' =>"登陆成功",

        );
        echo json_encode($dat);

    } else {
        $dat = array(
            'message' =>"登陆失败.账号/密码错误",
        );
        echo json_encode($dat);
    }
}
catch (Exception $e) {
    // 回滚事务
    // $pdo->rollback();
    echo $e->getMessage();

}
